From: smh22@boulderdash.cl.cam.ac.uk Date: Tue, 17 Dec 2002 19:00:45 +0000 (+0000) Subject: bitkeeper revision 1.7.1.9 (3dff745dQXvY5lV_SsLHnw3PlaxUMw) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~19116^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=81c4896212ba7d3d6cbb616617210fec1be58e89;p=xen.git bitkeeper revision 1.7.1.9 (3dff745dQXvY5lV_SsLHnw3PlaxUMw) robusify /proc/vfr parsing and xen Makefile tweak --- diff --git a/xen-2.4.16/Makefile b/xen-2.4.16/Makefile index 7ede454ee8..846c0e6f12 100644 --- a/xen-2.4.16/Makefile +++ b/xen-2.4.16/Makefile @@ -4,6 +4,7 @@ export BASEDIR := $(shell pwd) include Rules.mk default: $(TARGET) + gzip -f -9 < $(TARGET) > $(TARGET).gz install: $(TARGET) gzip -f -9 < $(TARGET) > $(TARGET).gz diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c index d6f6616262..13fe25ec9c 100644 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c @@ -56,6 +56,9 @@ static int vfr_read_proc(char *page, char **start, off_t off, * */ +#define isspace(_x) ( ((_x)==' ') || ((_x)=='\t') || ((_x)=='\v') || \ + ((_x)=='\f') || ((_x)=='\r') || ((_x)=='\n') ) + static int vfr_write_proc(struct file *file, const char *buffer, u_long count, void *data) { @@ -70,12 +73,12 @@ static int vfr_write_proc(struct file *file, const char *buffer, memset(&op, 0, sizeof(network_op_t)); // get the command: - while ( count && (buffer[ts] == ' ') ) { ts++; count--; } // skip spaces. + while ( count && isspace(buffer[ts]) ) { ts++; count--; } // skip spaces. te = ts; - while ( count && (buffer[te] != ' ') ) { te++; count--; } // command end + while ( count && !isspace(buffer[te]) ) { te++; count--; } // command end if ( te <= ts ) goto bad; tl = te - ts; - + if ( strncmp(&buffer[ts], "ADD", tl) == 0 ) { op.cmd = NETWORK_OP_ADDRULE; @@ -119,18 +122,19 @@ static int vfr_write_proc(struct file *file, const char *buffer, while (count) { //get field - ts = te; while ( count && (buffer[ts] == ' ') ) { ts++; count--; } + ts = te; while ( count && isspace(buffer[ts]) ) { ts++; count--; } te = ts; - while ( count && (buffer[te] != ' ') && (buffer[te] != '=') ) + while ( count && !isspace(buffer[te]) && (buffer[te] != '=') ) { te++; count--; } - if ( te <= ts ) goto bad; + if ( te <= ts ) + goto doneparsing; tl = te - ts; fs = ts; fe = te; fl = tl; // save the field markers. // skip " = " (ignores extra equals.) - while ( count && ((buffer[te] == ' ') || (buffer[te] == '=')) ) + while ( count && (isspace(buffer[te]) || (buffer[te] == '=')) ) { te++; count--; } ts = te; - while ( count && (buffer[te] != ' ') ) { te++; count--; } + while ( count && !isspace(buffer[te]) ) { te++; count--; } tl = te - ts; if ( (fl <= 0) || (tl <= 0) ) goto bad; @@ -176,9 +180,9 @@ static int vfr_write_proc(struct file *file, const char *buffer, op.u.net_rule.dst_interface = anton(&buffer[ts], tl); } else if ( (strncmp(&buffer[fs], "proto", fl) == 0)) - { - if (strncmp(&buffer[ts], "any", tl) == 0) - op.u.net_rule.proto = NETWORK_PROTO_ANY; + { + if (strncmp(&buffer[ts], "any", tl) == 0) + op.u.net_rule.proto = NETWORK_PROTO_ANY; if (strncmp(&buffer[ts], "ip", tl) == 0) op.u.net_rule.proto = NETWORK_PROTO_IP; if (strncmp(&buffer[ts], "tcp", tl) == 0)